#include <gtk/gtk.h>
#include <string.h>
#include "common.h"

int main(int argc,char *argv[])
{
    GtkWidget *window;
    GtkWidget *fixed;
    GtkWidget *button1;
    GtkWidget *button2;
    GtkWidget *button3;

    GdkColor  color_black_ = {0x0, 0xffff, 0xffff, 0xffff};

    gtk_init(&argc,&argv);

    /* create the main, top level, window */
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), TITLE);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window), 250, 200);
    gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color_black_); /*设置为黑色背景*/

    /*fixed*/
    fixed = gtk_fixed_new();
    gtk_container_add(GTK_CONTAINER(window), fixed);

    /*buttons*/
    button1 = gtk_button_new_with_label("Button1");
    button2 = gtk_button_new_with_label("Button2");
    button3 = gtk_button_new_with_label("Button3");

    gtk_fixed_put(GTK_FIXED(fixed), button1, 150, 50);
    gtk_fixed_put(GTK_FIXED(fixed), button2, 15, 15);
    gtk_fixed_put(GTK_FIXED(fixed), button3, 100, 100);

    gtk_widget_set_size_request(GTK_WIDGET(button1), 80, 35);
    gtk_widget_set_size_request(GTK_WIDGET(button2), 80, 35);
    gtk_widget_set_size_request(GTK_WIDGET(button3), 80, 35);

    g_signal_connect_swapped(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);


    /* make sure that everything, window and label, are visible */
    gtk_widget_show_all(window);

    /* start the main loop, and let it rest until the application is closed */
    gtk_main();

    return 0;
}
